package sk.ygor.raynor.rebind.serializable

import com.google.gwt.core.ext.typeinfo.JType
import sk.ygor.raynor.client.json.JSONSerializationException


object ForbiddenTypeAnalysis extends TypeAnalysis {
  private val forbiddenTypes = List(
    "java.lang.Object"
    )

  def runAnalysis(serializableType: JType) = {
    for (forbiddenType <- forbiddenTypes) {
      if (serializableType.getQualifiedSourceName.equals(forbiddenType)) {
        throw new JSONSerializationException("Forbidden: " + forbiddenType)
      }
    }
    Rejected("Not forbidden")
  }
}